package com.legal.aid.app.controller;

import com.legal.aid.common.core.controller.BaseController;
import com.legal.aid.app.domain.vo.ConsultVo;
import com.legal.aid.app.service.IAppConsultService;
import com.legal.aid.common.core.domain.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/app/consult")
public class AppConsultController extends BaseController {

    @Autowired
    private IAppConsultService appConsultService;

    // 获取咨询状态
    @GetMapping("/status")
    public AjaxResult getConsultStatus(@RequestParam Long userId, @RequestParam Long lawyerId) {
        ConsultVo consultVo = appConsultService.getConsultStatus(userId, lawyerId);
        return AjaxResult.success(consultVo);
    }

    // 用户确认结束咨询
    @PostMapping("/confirmEnd")
    public AjaxResult confirmEndConsult(@RequestParam Integer consultId) {
        boolean result = appConsultService.confirmEndConsult(Long.valueOf(consultId));
        return result ? AjaxResult.success("已结束") : AjaxResult.error("操作失败");
    }

}
